/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.worldscale.xp.wslib.im.jabber.impl;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import javax.net.SocketFactory;
import javax.net.ssl.SSLSocketFactory;

/**
 *
 * @author Kun
 */
public class MySSLConnection implements MyAbstractConnection {

    public static MySSLConnection open(String host, int port) throws IOException {
        final SocketFactory factory = SSLSocketFactory.getDefault();
        final Socket sock = factory.createSocket(host, port);
        return new MySSLConnection(sock);
    }
    private final Socket mSock;

    private MySSLConnection(Socket sock) {
        mSock = sock;
    }

    public void close() throws IOException {
        mSock.close();
    }

    public InputStream openInputStream() throws IOException {
        return mSock.getInputStream();
    }

    public OutputStream openOutputStream() throws IOException {
        return mSock.getOutputStream();
    }

    public void startTLS() throws IOException {
    }
}
